#ifndef EVENTENGINE_H
#define EVENTENGINE_H

#include <QObject>
#include <QSharedPointer>
#include <QHash>
#include "global/Event.h"
#include "../plugin/BasePlugin.h"

#include "common_global.h"

class EventEnginePrivate;

class COMMONSHARED_EXPORT EventEngine : public QObject
{
    Q_OBJECT
private:
    static EventEngine sInst;
public:
    using PluginMap = QHash<QString,BasePlugin*>;

    static EventEngine* GetInstance(){
        return &sInst;
    }

    void DipatchEvent(Event event, void* pData, BasePlugin* pSender);

    void RegisterEvent(Event event, BasePlugin* pSender);

    void UnregisterEvent(Event event, BasePlugin* pSender);

signals:

public slots:

private:
    EventEngine();
    ~EventEngine();

    EventEngine(const EventEngine&) = delete;
    EventEngine& operator=(const EventEngine&) = delete;

    EventEnginePrivate* _p = nullptr;
};

#endif // EVENTENGINE_H
